-
Notifications
You must be signed in to change notification settings - Fork 295
feat(sdk-coin-sol): implement staking activate for jito #6502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
212683d
to
634a453
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we don't even have an _isTestnet
flag and the parameters that depend on the flag (JITO reserve stake account address and manager fee address) can be set using coin information or token information.
* @param {TransactionInstruction} instruction | ||
* @returns {DepositSolParams} | ||
*/ | ||
export function decodeDepositSol(instruction: TransactionInstruction): DepositSolParams { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we could just use @solana/spl-stake-pool/StakePoolInstruction.decodeDepositSol
, but the latest client on NPM is out of date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left comments in a mirrored PR #6501
634a453
to
d1fba71
Compare
d1fba71
to
be557de
Compare
Fixed.
We've used isJito in staking-service and wallet-platform, so I'm following the convention.
Fixed. I was using it for encoding base58. Now I'm using the bs58 package.
Fixed. Originally I called it
Do you have any ideas where to store the following information? Should it be a new field in |
@@ -13,9 +13,12 @@ export class StakingActivateBuilder extends TransactionBuilder { | |||
protected _stakingAddress: string; | |||
protected _validator: string; | |||
protected _isMarinade = false; | |||
protected _isJito = false; | |||
protected _isTestnet: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this _isTestnet
and isTestnet
in StakingActivate
. It does not look clean.
In TransactionBuilder, you can save _coinConfig
locally and passdown into solInstructionFactory
and then decide what those configs are.
@@ -114,6 +115,8 @@ export interface StakingActivate { | |||
amount: string; | |||
validator: string; | |||
isMarinade?: boolean; | |||
isJito?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create an enum for marinade, jito. There might be new staking types later. You can refactor in a separate PR with WP changes
Pasting AI review results 🚨 CODE REVIEW - CRITICAL ISSUES FOUND OVERALL ASSESSMENT: NEEDS MAJOR REVISION ❌ This PR has significant architectural problems and violates several best practices. DO NOT MERGE without addressing these issues. 🔴 CRITICAL ISSUES
Location: src/lib/iface.ts:91 Problems:
Fix Required: Remove this parameter and derive network automatically from CoinConfig
Location: src/lib/stakingActivateBuilder.ts:21, 41 Problems:
Location: src/lib/solInstructionFactory.ts:257-262 Problems:
🟡 MODERATE ISSUES
Location: src/lib/instructionParamsFactory.ts:345-347 Problems:
Location: src/lib/solInstructionFactory.ts:255 Problems:
🟢 POSITIVE ASPECTS ✅ Good: Proper TypeScript typing throughout 📝 RECOMMENDED REFACTORING Instead of the current approach, implement:
}
🛑 BLOCKING ISSUES FOR MERGE
Estimated rework: 4-6 hoursRisk level: High (affects core transaction building) This PR shows promise but needs significant architectural improvements before it can be merged safely. |
Description
This PR updates
StakingActivate
to support Solana staking with JitoSOL tokens. To do so, it adds support for thedepositSol
solana/spl-stake-pool instruction.Issue Number
TICKET: SC-2314
Type of change
How Has This Been Tested?
A new unit test to build the transaction has been added to
modules/sdk-coin-sol/test/unit/transactionBuilder/stakingActivateBuilder.ts
.An example script has been added to
examples/ts/sol/jito-stake.ts
. Here is a transaction produced by running the example script.